﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

namespace _1stVATCWed
{
    public partial class TrangChu : System.Web.UI.Page
    {
        public string IDsanpham;
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void Repeater1_Load(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            string Sql = "select top 9 * from SANPHAM order by ngay desc";
            SqlCommand cmd = new SqlCommand(Sql, conn);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            conn.Open();

            DataSet ds = new DataSet();
            adapter.Fill(ds, "Table SANPHAM");
            DataTable dt = ds.Tables["Table SANPHAM"];
            Repeater1.DataSource = ds.Tables["Table SANPHAM"].DefaultView;
            Repeater1.DataBind();
            foreach (DataRow r in dt.Rows)
            {
                IDsanpham = r["IDsanpham"].ToString() ;
                Session["IDsanpham"] = IDsanpham;
            }
        }

        
    }
}